/*
 +-----------------------------------------------------------------------------------------------+
 | Project : UKAPI
 +-----------------------------------------------------------------------------------------------+
 | Project Description : Universal & Kernel API
 +-----------------------------------------------------------------------------------------------+
 | File Description :
 |   BITMAP
 |                                                 
 +-----------------------------------------------------------------------------------------------+
 | Licence : MIT Licence
 +-----------------------------------------------------------------------------------------------+
 | Copyright (c) 2006 Olivier Vanhoucke
 | 
 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
 | and associated documentation files (the "Software"), to deal in the Software without 
 | restriction, including without limitation the rights to use, copy, modify, merge, publish, 
 | distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 
 | Software is furnished to do so, subject to the following conditions:
 | 
 | The above copyright notice and this permission notice shall be included in all copies or 
 | substantial portions of the Software.
 | 
 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 +-----------------------------------------------------------------------------------------------+
*/

#ifndef __UKAPI_GUI_BMP__
#define __UKAPI_GUI_BMP__

#include <ukapi.h>

#pragma pack( push, 1 )

typedef struct
{
	word_t		bfType;			/* Magic number for file */
	dword_t		bfSize;			/* Size of file */
	word_t		bfReserved1;	/* Reserved */
	word_t		bfReserved2;	/* ... */
	dword_t		bfOffBits;		/* Offset to bitmap data */
} bitmap_file_header_t, *pbitmap_file_header_t;

#pragma pack( pop )

#define BF_TYPE 0x4D42			/* "MB" */

typedef struct					/**** BMP file info structure ****/
{
	dword_t		biSize;           /* Size of info header */
	int32_t		biWidth;          /* Width of image */
	int32_t		biHeight;         /* Height of image */
	word_t		biPlanes;         /* Number of color planes */
	word_t		biBitCount;       /* Number of bits per pixel */
	dword_t		biCompression;    /* Type of compression to use */
	dword_t		biSizeImage;      /* Size of image data */
	int32_t		biXPelsPerMeter;  /* X pixels per meter */
	int32_t		biYPelsPerMeter;  /* Y pixels per meter */
	dword_t		biClrUsed;        /* Number of colors used */
	dword_t		biClrImportant;   /* Number of important colors */
} bitmap_info_header_t, *pbitmap_info_header_t;

/*
 * Constants for the biCompression field...
 */        

/*
typedef enum
{

} 
*/
#define BI_RGB        0L	/* No compression - straight BGR data */
#define BI_RLE8       1L	/* 8-bit run-length compression */
#define BI_RLE4       2L	/* 4-bit run-length compression */
#define BI_BITFIELDS  3L	/* RGB bitmap with RGB masks */
#define BI_JPEG       4L
#define BI_PNG        5L

typedef struct				/**** Colormap entry structure ****/
{
	byte_t	rgbBlue;          /* Blue value */
	byte_t	rgbGreen;         /* Green value */
	byte_t	rgbRed;           /* Red value */
	byte_t	rgbReserved;      /* Reserved */
} rgbquad_t;

typedef struct				/**** Bitmap information structure ****/
{
	bitmap_info_header_t	bmiHeader;      /* Image header */
	rgbquad_t				bmiColors[256]; /* Image colormap */
} bitmap_info_t, *pbitmap_info_t;

#ifdef __cplusplus
	extern "C" {
#endif /* __cplusplus */

// result_t bitmap_create( pbitmap_t pbmp, dword_t x, dword_t y, dword_t nb_colors );
// bitmap_set_pixelXY()
// bitmap_get_pixelXY()
// bitmap_read_file
// bitmap_write_file

#ifdef __cplusplus
	}
#endif /* __cplusplus */

#endif /* __UKAPI_GUI_BMP__ */